<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="net.sf.rose.business.service.ActionService" %>
<%@ page import="net.sf.rose.business.bean.action.ActionUnitSearchBean" %>
<%@include file="/common/header.jsp"%>

<div class="pageContent" >
	<div class="pageHeader">
		<form onsubmit="return navTabSearch(this);" action="${path}/search.html?tableName=BS_SHIP&tableAction=list&jsp=ship/base/ship_list" method="post">
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>查询操作单元名称：</td>
					<td>
						<select class="combox" name="actionUnitSearchBeanName" onchange=""  >
							<option value="empty">无</option>
							<%
							java.util.Map<String, ActionUnitSearchBean> map = ActionService.getAlltSearchActionUnit();
							Object actionUnitSearchBeanName = request.getAttribute("actionUnitSearchBeanName");
							ActionUnitSearchBean actionUnitSearchBean = null;
							if(actionUnitSearchBeanName != null){
								actionUnitSearchBean = map.get(actionUnitSearchBeanName);
							}else{
								actionUnitSearchBean = new ActionUnitSearchBean();
								actionUnitSearchBean.setName("");
								actionUnitSearchBean.setDescription("");
							}
							if(map.size()>0){
								for(ActionUnitSearchBean action : map.values()){
							%>
								<option value="<%=action.getName() %>"  <%if(actionUnitSearchBean.getName().equals(action.getName())){ %>selected="selected"<%} %> ><%=action.getName() %></option>
							<%}} %>
						</select>
					</td>
					<td>查询缓存名称：</td>
					<td>
						<select class="combox" name="cacheName" onchange=""  >
							<option value="empty">无</option>
							<%
							if(actionUnitSearchBean.getCacheNameList().size()>0){
								Object cacheName = request.getAttribute("cacheName");
								for(String str : actionUnitSearchBean.getCacheNameList()){
							%>
								<option value="<%=str%>"  <%if(cacheName.equals(str)){ %>selected="selected"<%} %> ><%=str%></option>
							<%}} %>
						</select>
					</td>
					<td>描述：</td>
					<td>
						<input type="text" name="DESCRIPTION" value="<%=actionUnitSearchBean.getDescription() %>" />
					</td>
				</tr>
			</table>
		</div>
		</form>
	</div>

	<table class="table" width="100%" layoutH="75">
		<thead>
			<tr>
				<th width="80">编号</th>
				<th width="120">创建人</th>
				<th width="120">创建时间</th>
				<th width="80">标题</th>
			</tr>

		</thead>
			<tbody>
			<c:if test="${! empty page.records }">
			<c:forEach var="vo" items="${page.records}">
			<tr target="CONTENTID" rel="${vo.CONTENTID}">
				<td>${vo.CONTENTID}</td>
				<td>${vo.CREATOR}</td>
				<td>${vo.CREATETIME}</td>
				<td>${vo.TITLE}</td>
			</tr>
			</c:forEach>
			</c:if>
		</tbody>
	</table>

</div>
<script type="text/javascript">
/**
 * dialog上的表单提交回调函数
 * 服务器转回navTabId，可以重新载入指定的navTab. statusCode=DWZ.statusCode.ok表示操作成功, 自动关闭当前dialog
 * form提交后返回json数据结构,json格式和navTabAjaxDone一致
 */
function dialogAjaxDone(json){
	DWZ.ajaxDone(json);
	if (json.statusCode == DWZ.statusCode.ok){
		// alertMsg.correct(json.message);
		if(json.callbackType){
			var url = "${path}/list.html";
			navTab.reload(url,null,"base_define_action_unit_list");
			// navTab.reload(url);
			//navTab.reloadFlag("base_define_action_list"); // 下次切换到列表页签时需要刷新一下
			setTimeout(function(){$.pdialog.closeCurrent();}, 100); // 关闭此编辑页签
		}
	}
}

function save(){
	//$("#xxxId", $.pdialog.getCurrent());
	//alert($("#actionName").val());
	//alert($("#actionName", "base_define_action_unit_list").val());
	//alert($("#bean_name", $.pdialog.getCurrent()).val());
	//alert($.pdialog.getParent());
	$(form).submit();
}

function deleteAction(){
	var rel = '';
	$('.base_define_action_unit_list_tr').each(function(){
		if($(this).hasClass("selected")){
			rel = $(this).attr('rel');
		}
	});
	if(rel==''){
		alertMsg.warn('请先选择一条数据！');
	}else{
		alertMsg.confirm("确定要删除吗?", {
			okCall: function(){
				var arr = rel.split(","); //字符分割 
				var url = "${path}/delete.html?type=action&id=" + arr[1];
				$.ajax({
					type: "post", url: url,
					success: function(json){
						alertMsg.correct(json.msg);
						var url = "${path}/list.html";
						navTab.reload(url);
						setTimeout(function(){$.pdialog.closeCurrent();}, 100); // 关闭此编辑页签
					},
					error: function(){
						alertMsg.error('系统错误，请联系管理员！');
					}
				});
			}
		});
	}
}
</script>